package com.xiaozhi.module.iot.DTO;

import cn.hutool.ai.ModelName;
import com.fasterxml.jackson.annotation.JsonAlias;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import io.github.linpeilie.annotations.AutoMapper;
import io.github.linpeilie.annotations.AutoMapping;
import lombok.Data;
import com.xiaozhi.module.iot.entity.IotDevice;

/**
 * @author weirdor
 */
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
@AutoMapper(target = IotDevice.class)
public class OtaDTO {

    @JsonAlias({"mac_address", "mac"})
    private String mac;

    @AutoMapping(target = "chipModelName")
    private String chipModelName;

    @AutoMapping(source = "application.version", target = "version")
    private Application application;

    @AutoMapping(source = "board.type", target = "boardType")
    @AutoMapping(source = "board.name", target = "boardName")
    @AutoMapping(source = "board.ssid", target = "wifiSsid")
    @AutoMapping(source = "board.rssi", target = "wifiRssi")
    @AutoMapping(source = "board.ip", target = "boardIp")
    @AutoMapping(source = "board.mac", target = "boardMac")
    private Board board;

    @Data
    public static class Application {
        private String version;
        private String name;
    }

    @Data
    public static class Board {
        private String type;
        private String name;
        private String ssid;
        private Integer rssi;
        private String ip;
        private String mac;
    }
}
